from flask_restful import Resource

from restful.api__.session import  login_required_current_user_generate, \
    uid_required_target_user_generate
from restful.model.query import QueryMultipleInstances
from restful.model.tables import Like
from restful.response import ResponseSuccess
#uid喜欢那些帖子
class UserAllLikes(Resource):
    @login_required_current_user_generate
    @uid_required_target_user_generate
    def post(self,target_user,current_user):
        likes = QueryMultipleInstances(Like,{'uid':target_user.id})
        return ResponseSuccess(data=[{
                'pid':i.pid,
                'time':i.time
            } for i in likes]
        )